import { NgModule } from '@angular/core';
import {Routes,RouterModule} from '@angular/router'
import {LayoutComponent} from './layout/layout.component';
import {LoginComponent} from './login/login.component';
import {MainComponent} from './layout/main/main.component';


const routes: Routes = [
// 主页面
  {
    path: 'home',
    component: LayoutComponent,
    children: [
      {
        path: '',
        redirectTo: 'index',
        pathMatch: 'full'
      },
      {
        path: 'index',
        component: MainComponent
      }
    ]
  },
  // 登录
  {
    path: 'login',
    component: LoginComponent
  },
  {
    path: '**',
    redirectTo: 'home/index',
    pathMatch: 'full'
  }
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes)
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
